Part 1: Explore the Data

Examine data with day number as the factor

Examine data with neuroticism as the factor

Group data by person and examine with neuroticism as the factor

Part 2: Create and Evaluate Models

Create multi-level model to predict negative affect based on stress (2 variables), neuroticism, and day with random y-intercept and factor person.

## Linear mixed model fit by REML ['lmerMod']
## Formula: negaff ~ day + stress_trait_c + stress_state + bfi_n + (1 | id)
##    Data: mlmdta
## 
## REML criterion at convergence: 3177.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6448 -0.6178 -0.0525  0.5132  4.1735 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  id       (Intercept) 0.1853   0.4305  
##  Residual             0.4416   0.6645  
## Number of obs: 1430, groups:  id, 189
## 
## Fixed effects:
##                 Estimate Std. Error t value
## (Intercept)     2.209688   0.124424  17.759
## day            -0.064129   0.007691  -8.338
## stress_trait_c  0.966366   0.077996  12.390
## stress_state    0.843730   0.035591  23.706
## bfi_n           0.159109   0.038844   4.096
## 
## Correlation of Fixed Effects:
##             (Intr) day    strs__ strss_
## day         -0.221                     
## strss_trt_c  0.212  0.005              
## stress_stat  0.001 -0.010  0.000       
## bfi_n       -0.933  0.007 -0.225  0.002

Analysis of Model:

Fixed Effects:

(Intercept) The expected value of negative effect for a prototypical student on a typical day with typical stress variables and neuroticism is 2.209688.

The t-values for day, neuroticism, and both stress variables are outside of the expected value, meaning we would reject the null hypothesis that no effect was observed for all of the variables.

Random Effects:

The standard deviation of the intercept is 0.4305 which means there is little variation in the between person differences in negative effects.

Original Plot

## `geom_smooth()` using formula 'y ~ x'

Predicted Plot

## $id

Model with random y-intercept and random slope of both stress variables

## Linear mixed model fit by REML ['lmerMod']
## Formula: negaff ~ day + stress_trait_c + stress_state + bfi_n + (1 | id)
##    Data: mlmdta
## 
## REML criterion at convergence: 3177.7
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.6448 -0.6178 -0.0525  0.5132  4.1735 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  id       (Intercept) 0.1853   0.4305  
##  Residual             0.4416   0.6645  
## Number of obs: 1430, groups:  id, 189
## 
## Fixed effects:
##                 Estimate Std. Error t value
## (Intercept)     2.209688   0.124424  17.759
## day            -0.064129   0.007691  -8.338
## stress_trait_c  0.966366   0.077996  12.390
## stress_state    0.843730   0.035591  23.706
## bfi_n           0.159109   0.038844   4.096
## 
## Correlation of Fixed Effects:
##             (Intr) day    strs__ strss_
## day         -0.221                     
## strss_trt_c  0.212  0.005              
## stress_stat  0.001 -0.010  0.000       
## bfi_n       -0.933  0.007 -0.225  0.002

Analysis of Model:

Fixed Effects:

(Intercept) The expected value of negative effect for a prototypical student on a typical day with typical stress variables and neuroticism is 2.209688.

The t-values for day, neuroticism, and both stress variables are outside of the expected value, meaning we would reject the null hypothesis that no effect was observed for all of the variables.

Random Effects:

The standard deviation of the intercept is 0.4305 which means there is little variation in the between person differences in negative effects.

Original Plot

Predicted Plot

## $id